package com.seray.zebraprintlib.content;

import android.text.TextUtils;

import com.seray.zebraprintlib.config.PrintConfig;

/**
 * Author：李程
 * CreateTime：2018/8/8 15:46
 * E-mail：licheng@kedacom.com
 * Describe：字体
 */
public class TextContent extends AZebraContent {

    public TextContent(int x, int y, String key, String content) {
        super(x, y, PrintConfig.NORMAL_TEXT_SIZE, PrintConfig.Direction.N, key, content);
        LINE_TYPE = "^A1";
    }

    public TextContent(int x, int y, int size, String content) {
        super(x, y, size, PrintConfig.Direction.N, null, content);
        LINE_TYPE = "^A1";
    }

    public TextContent(int x, int y, int size, String key, String content) {
        super(x, y, size, PrintConfig.Direction.N, key, content);
        LINE_TYPE = "^A1";
    }

    public TextContent(int x, int y, String content) {
        super(x, y, PrintConfig.NORMAL_TEXT_SIZE, PrintConfig.Direction.N, null, content);
        LINE_TYPE = "^A1";
    }

    public TextContent(int x, int y, int size, PrintConfig.Direction direction, String content) {
        super(x, y, size, direction, null, content);
        LINE_TYPE = "^A1";
    }

    public TextContent(int x, int y, PrintConfig.Direction direction, String content) {
        super(x, y, PrintConfig.NORMAL_TEXT_SIZE_SMALL, direction, null, content);
        LINE_TYPE = "^A1";
    }

    public TextContent(int x, int y, PrintConfig.Direction direction, String key, String content) {
        super(x, y, PrintConfig.NORMAL_TEXT_SIZE_SMALL, direction, key, content);
        LINE_TYPE = "^A1";
    }

    public TextContent(int x, int y, int size, PrintConfig.Direction direction, String key, String content) {
        super(x, y, size, direction, key, content);
        LINE_TYPE = "^A1";
    }

    @Override
    public String install() {
        return LINE_START
                + x + COMMA
                + y
                + LINE_TYPE
                + direction + COMMA
                + size + COMMA
                + size
                + FILED_START + (TextUtils.isEmpty(key) ? "" : key + "：")
                + content + FILED_END
                + BREAK;
    }
}
